<%@ page import="java.util.List"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="com.hargasembako.core.entity.*"%>
<%
	Store store = (Store) request.getAttribute("store");
	List<ProductPrice> prices = (List<ProductPrice>) request.getAttribute("prices");
	SimpleDateFormat sdf = new SimpleDateFormat("M/d/yyyy");
%>
<html>
<head>
<title>Harga Sembako - Display Harga</title>
<link rel="stylesheet" type="text/css" href="/stylesheets/styles.css" />
</head>
<body>
	<span class="nav"><a href="/index.html">Search</a>
	</span>
	<p />
	<span class="title">Store Display</span>
	<p />
	<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">
		<tr bgcolor="#407BA8">
			<td style="color: #ffffff; font-weight: bold;">Name</td>
			<td bgcolor="#ffffff"><%=store.getName()%></td>
		</tr>
		<tr bgcolor="#407BA8">
			<td style="color: #ffffff; font-weight: bold;">Address</td>
			<td bgcolor="#ffffff"><%=store.getAddress()%></td>
		</tr>
		<tr bgcolor="#407BA8">
			<td style="color: #ffffff; font-weight: bold;">City</td>
			<td bgcolor="#ffffff"><%=store.getCity()%></td>
		</tr>
		<tr bgcolor="#407BA8">
			<td style="color: #ffffff; font-weight: bold;">State</td>
			<td bgcolor="#ffffff"><%=store.getState()%></td>
		</tr>
		<tr bgcolor="#407BA8">
			<td style="color: #ffffff; font-weight: bold;">Phone</td>
			<td bgcolor="#ffffff"><%=store.getPhone()%></td>
		</tr>
	</table>
	<br>
	<a	href="price?action=priceCreate&storeId=<%=store.getId()%>">Create a new ProductPrice</a>
	<p />
	<%
		if (prices.size() > 0) {
	%>
	<p />
	<span class="heading">ProductPrices for <%=store.getName()%></span>
	<br>
	<p />
	<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">
		<tr bgcolor="#407BA8">
			<td style="color: #ffffff; font-weight: bold;">Name</td>
			<td style="color: #ffffff; font-weight: bold;">Price</td>
			<td style="color: #ffffff; font-weight: bold;">LastUpdate</td>
		</tr>
		<%
			for (int i = 0; i < prices.size(); i++) {
		%>
		<%
			ProductPrice o = (ProductPrice) prices.get(i);
		%>
		<tr style="background: #ffffff"
			onMouseOver="this.style.background='#eeeeee';"
			onMouseOut="this.style.background='#ffffff';">
			<td nowrap><%=o.getProductId()%></td>
			<td>$<%=o.getPrice()%></td>
			<td><%=o.getLastUpdate()%></td>
		</tr>
		<%
			}
		%>
	</table>
	<%
		} else {
	%>
	<p />
	<span class="heading">No ProductPrices found for <%=store.getName()%></span>
	<%
		}
	%>
</body>
</html>
